/*下拉框后台*/
'use strict';
const unitComboSettingAction = require('../actions/comboSetting/unitComboSettingAction');
const principalComboSettingAction = require('../actions/comboSetting/principalComboSettingAction');
const departmentComboSettingAction = require('../actions/comboSetting/departmentComboSettingAction');
const engineeringComboSetting = require('../actions/comboSetting/engineeringComboSettingAction');
const engineeringNoComboSetting = require('../actions/comboSetting/engineeringNoComboSettingAction');
const manageDepartmentComboSettingAction = require('../actions/comboSetting/manageDepartmentComboSettingAction');
const groupComboSettingAction = require('../actions/comboSetting/groupComboSettingAction');
const buildingUseComboSettingAction = require('../actions/comboSetting/buildingUseComboSettingAction');
const structureComboSettingAction = require('../actions/comboSetting/structureComboSettingAction');
const regionComboSettingAction = require('../actions/comboSetting/regionComboSettingAction');
module.exports = async function (ctx) {
    let param = ctx.method === 'GET' ? ctx.query : ctx.request.fields;
    param.user_id=ctx.session.user.user_id;
    param.is_manager = ctx.session.user.is_manager;
    let action_type = param.action_type;
    try {
        switch (action_type) {
            case 'unitComboSetting': // 单位下拉框
                ctx.body = await unitComboSettingAction(param);
                break;
            case 'principalComboSetting': // 人员下拉框
                ctx.body = await principalComboSettingAction(param);
                break;
            case 'departmentComboSetting': // 部门下拉框
                ctx.body = await departmentComboSettingAction(param);
                break;
            case 'manageDepartmentComboSettingAction': // 角色管理部门下拉框
                ctx.body = await manageDepartmentComboSettingAction(param);
                break;
            case 'engineeringComboSetting': // 工程下拉框
                ctx.body = await engineeringComboSetting(param);
                break;
            case 'engineeringNoComboSetting': // 工程序号下拉框
                ctx.body = await engineeringNoComboSetting(param);
                break;
            case 'groupComboSetting': // 角色下拉框
                ctx.body = await groupComboSettingAction(param);
                break;
            case 'buildingUseComboSetting' : //工程用途下拉框
                ctx.body = await buildingUseComboSettingAction(param);
               break;
            case 'structureComboSetting' : //工程结构下拉框
                ctx.body = await structureComboSettingAction(param);
                break;
            case 'regionComboSetting' : //区域下拉框
                ctx.body = await regionComboSettingAction(param);
                break;
        }
    } catch (e) {
        ctx.body = {success: false, message: e.message};
    }

};